#!/usr/bin/env python
# -*- coding: latin-1 -*-
# -*- coding: cp1252 -*-

# Virðist virka þó það komi random tala af nýjum línum sem ég nenni ekki að finna út af hverju gerist

inputFile = open('forrit.txt', 'r')
outputFile = open('forritAnKommenta.txt', 'w')

skrifaLinu = True
for line in inputFile.readlines():
	if line.find("/*") != -1 and line.find("*/") != -1:
		outputFile.write(line[:line.find("/*")] + line[line.find("*/")+2:])
		buid = True
	elif line.find("/*") != -1:
		skrifaLinu = False
		outputFile.write(line[:line.find("/*")])
		buid = True
	elif line.find("*/") != -1:
		skrifaLinu = True
		outputFile.write(line[line.find("*/")+2:])
		buid = True
	elif line.find("//") != -1 and skrifaLinu:
		outputFile.write(line[:line.find("//")] + "\n")
	elif skrifaLinu:
		outputFile.write(line + "\n")
